using System.Collections;
using UnityEngine;

public class MsgScaleToUp : MessageBase
{
	public Animation animationComp;

	public AnimationClip animText;

	public UILabel lbTxtF;

	public UILabel lbTxtBack;

	public bool isPlay;

	public override void SetColor(Color clF, Color clB)
	{
		lbTxtF.color = clF;
		lbTxtBack.color = clB;
	}

	public override void SetText(string text)
	{
		lbTxtF.text = text;
		lbTxtBack.text = text;
	}

	public override void StartMessage()
	{
		isPlay = true;
		lbTxtF.gameObject.SetActive(true);
		animationComp.clip = animText;
		animationComp.Play();
		StartCoroutine(WaitEndPlayAnimation());
	}

	public override void Wait()
	{
		lbTxtF.gameObject.SetActive(false);
	}

	private IEnumerator WaitEndPlayAnimation()
	{
		while (animationComp.isPlaying)
		{
			yield return new WaitForEndOfFrame();
		}
		isPlay = false;
		MessageManager.OnCompleteMessage(this);
	}
}
